$(function(){
    window.onload = function(){
        $.ajax({
            url: 'http://localhost:3000/useing/public',
            type: 'get',
            success: function(res){
                // 请求的数据
                // console.log(res);
                // 遍历
                var str = '';
                $.each(res,function(index,item){
                
                    str += `
                          <li>
                            <img src=${item.img}>
                            <h3>${item.text}</h3>
                            <span>${item.totalnum}</span>
                            <span>${item.num}台</span>
                            <p><span class="sp5">${item.apply}</span>申请</p>
                            <h5>剩余时间2天</h5>
                        </li>
                    `
                })
                $('.main-3-visual-ul').html(str);
            }
          })
    }
    $('.main-2 span').click(function(){
        $(this).css('fontWeight','bold');
        $(this).siblings().css('fontWeight','initial');
        $('title').html('试用' + $(this).text());
    })

    $('.main-2 span').eq(0).click(function(){
        window.location.href = "../trial/trialall.html";
    })
    $('.main-2 span').eq(1).click(function(){
        window.location.href = "../trial/trialapply.html";
    })
    $('.main-2 span').eq(2).click(function(){
        window.location.href = "../trial/trialapply.html";
    })
    $('.main-2 span').eq(3).click(function(){
        window.location.href = "../trial/trialapply.html";
    })
    $('.main-1 span').eq(1).click(function(){
        window.location.href = "../trial/trialteacher.html";
    })
    $('.main-2 span').css('cursor','pointer');
    $('.main-1 span').css('cursor','pointer');


})